package com.blds.mc.controller;

import com.baomidou.mybatisplus.plugins.Page;
import com.blds.mc.entity.Mc;
import com.blds.mc.entity.vo.MediaVo;
import com.blds.mc.service.McService;
import com.blds.mc.service.MediaService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 素材接口
 * </p>
 *
 * @author stwyj
 * @since 2018/6/11
 */
@RestController
@RequestMapping("media")
public class MediaController {

    @Resource
    private MediaService mediaService;

    @Resource
    private McService mcService;

    /**
     * 获取素材列表
     *
     * @param pageIndex 第几页
     * @param pageSize  每页显示条数
     * @return 素材集合
     */
    @GetMapping("getMcList")
    public Page<MediaVo> getMcList(Integer pageIndex, Integer pageSize) {
        return mediaService.getMediaList(pageIndex, pageSize);
    }

    /**
     * 新增素材
     * @param mc 素材内容
     * @return
     */
    @PostMapping("addMc")
    public Object addMc(@RequestBody Mc mc) {
        return mcService.insert(mc);
    }
}
